package 搭配购买;

import java.util.*;

public class Main {
    static int N = 10010, n, m, V;
    static int[] v = new int[N];
    static int[] w = new int[N];
    static int[] f = new int[N];
    static int[] p = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        V = in.nextInt();
        for (int i = 1; i <= n; i++) {
            p[i] = i;
        }
        for (int i = 1; i <= n; i++) {
            v[i] = in.nextInt();
            w[i] = in.nextInt();
        }
        while (m-- > 0) {
            int a = in.nextInt();
            int b = in.nextInt();
            int pa = find(a), pb = find(b);
            if (pa != pb) {
                p[pa] = pb;
                w[pb] += w[pa];
                v[pb] += v[pa];
            }
        }
        for (int i = 1; i <= n; i++) {
            if (i == find(i)) {
                for (int j = V; j >= v[i]; j--) {
                    f[j] = Math.max(f[j], f[j - v[i]] + w[i]);
                }
            }
        }
        System.out.println(f[V]);
    }

    private static int find(int x) {
        if (x != p[x]) {
            p[x] = find(p[x]);
        }
        return p[x];
    }

}
